import { Menu } from "antd";
import { useNavigate, useLocation } from "react-router-dom";
import { HomeOutlined, HddOutlined } from "@ant-design/icons";

const menu = [
  {
    key: "home",
    label: "首页",
    icon: <HomeOutlined />
  },
  {
    key: "project",
    label: "我的项目",
    icon: <HddOutlined />
  }
];
export default function SurveyMenu() {
  const location = useLocation();
  const navigate = useNavigate();
  const selectedKe = location.pathname.replace("/", "").split("/");
  return <Menu selectedKeys={selectedKe} onSelect={value => navigate("/" + value.keyPath.reverse().join("/"))} mode="inline" theme="light" items={menu} />;
}
